package com.albaba.designpattern.iterator.text_001;

import java.util.ArrayList;

/**
 * @Description: TODO
 * @Author zx
 * @Date 2025/2/25 16:37
 * @Version 1.0
 */
public class Client {

    public static void main(String[] args) {
        ArrayList<String> names = new ArrayList<>();

        names.add("lisi");
        names.add("zhangsan");
        names.add("wangwu");

        Iterator<String> iterator = new ConcreteIterator<>(names);
        while (iterator.hasNext()) {
            System.out.println(iterator.currentItem());
            iterator.next();
        }

        java.util.Iterator<String> iteratored = names.iterator();
        while (iteratored.hasNext()) {
            System.out.println(iteratored.next());
        }
    }

}
